<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	<h:form id="surveySearch">
	<rich:collapsiblePanel expanded="true">
	<f:facet name="header">suchen . . .</f:facet>
	<table class="searchTable">
		<tr>
			<td>Bezeichnung</td>
			<td><h:inputText value="#{SurveyViewBean.label}" /></td>
			<td>Fragebogen</td>
			<td><h:inputText value="#{SurveyViewBean.questionSheetLabel}" /></td>
		</tr>
		<tr>
			<td>Ersteller</td>
			<td><rich:autocomplete value="#{SurveyViewBean.userName}" selectFirst="false" mode="cachedAjax" minChars="1" autocompleteMethod="#{SurveyViewBean.getCreatorNamesforAutoCompletion}"/></td>
			<td>Status</td>
			<td>
				<h:selectOneRadio value="#{SurveyViewBean.status}">
					<f:selectItem itemLabel="alle" itemValue="all"/>
					<f:selectItem itemLabel="aktiv" itemValue="true"/>
					<f:selectItem itemLabel="nicht aktiv" itemValue="false"/>
				</h:selectOneRadio>
			</td>
		</tr>
		<tr>
			<td colspan="4"><hr/></td>
		</tr>
		<tr>
			<td colspan="4"><center><a4j:commandButton id="searchButton" action="#{SurveyViewBean.refreshFilteredView()}" value="suchen" execute="surveySearch" render="survey_table datascrolleroben_survey datascrollerunten_survey" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();"/></center></td>
		</tr>
	</table>
	</rich:collapsiblePanel>
	</h:form>
	<center><rich:dataScroller id="datascrolleroben_survey" for="survey_table" maxPages="10" stepControls="auto" render="datascrollerunten_survey"/></center>
	<h:form id="surveyTableForm">
	
	<a4j:jsFunction  name="rowupdate" action="#{SurveyViewBean.innerCompShow()}" actionListener="#{SurveyViewBean.selectionListener}" execute="surveyTableForm" oncomplete="#{rich:component('surveyDetail')}.show();" render="surveyDetail">
    </a4j:jsFunction>
	<rich:extendedDataTable value="#{SurveyViewBean.surveys}" binding="#{SurveyViewBean.dataTable}"
            var="survey" id="survey_table" frozenColumns="5" rows="10"
             selectionMode="single" styleClass="questionOverviewTable"
            noDataLabel="keine Umfragen verfügbar" keepSaved="false" onready="InvokeClick('searchButton')"
            rowClasses="rowstyle1,rowstyle2" selection="#{SurveyViewBean.selection}" onrowdblclick="rowupdate()">

            <f:facet name="header">
                <h:outputText value="Umfragen" />
            </f:facet>
            <rich:column width="160px">
                <f:facet name="header">
                    <h:outputText value="Bezeichnung" />
                </f:facet>
			<h:outputText value="#{survey.bezeichnung}" />
		</rich:column>
        <rich:column width="160px">
                <f:facet name="header">
                    <h:outputText value="Fragebogen-Bez." />
                </f:facet>
                <h:outputText value="#{survey.fragebogen.bezeichnung}" />
        </rich:column>
        <rich:column width="150px">
                <f:facet name="header">
                    <h:outputText value="Ersteller" />
                </f:facet>
                <h:outputText value="#{survey.user.id}" />
        </rich:column>
        <rich:column width="50px">
                <f:facet name="header">
                    <h:outputText value="Aktiv" />
                </f:facet>
                <center><h:graphicImage value="/images/#{survey.status == true ? 'A' : 'N'}active.png" height="10px"/></center>
        </rich:column>
        <rich:column width="70px">
                <f:facet name="header">
                    <h:outputText value="Anonyme" />
                </f:facet>
                <center><h:graphicImage value="/images/#{survey.autorized == true ? 'N' : 'A'}active.png" height="10px"/></center>
        </rich:column>
        </rich:extendedDataTable>
        </h:form>
		<center><rich:dataScroller id="datascrollerunten_survey" for="survey_table" maxPages="10" stepControls="auto" render="datascrolleroben_survey"/></center>														
		

		<ui:include src="ChangeSurveyinnerComp.xhtml"/> 
		
</ui:composition>
